package com.jack.vipmis.vip.card.entity;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.springframework.format.annotation.DateTimeFormat;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.jack.vipmis.common.entity.BaseEntity;
import com.jack.vipmis.vip.business.entity.Business;

/**
 * 会员卡信息管理
 * 
 * @author JackLiang
 * @date 2014-6-5
 * @version 1.0
 */
@Entity
@Table(name = "card")
public class Card extends BaseEntity<Long> {

	@Column(name = "cardLogo")
	private String		cardLogo;

	@Column(name = "cardname")
	private String		cardName;
	/**
	 * 大类别
	 */
	@Column(name = "cardtype")
	private String		cardType;
	/**
	 * 会员卡折扣信息
	 */
	@Column(name = "cardSummary")
	private String		cardSummary;					// 折扣

	@Column(name = "cardSummaryContent")
	private String		cardSummaryContent;			// 折扣详细说明
	/**
	 * 商家地址
	 */
	@Column(name = "cardAddress")
	private String		cardAddress;

	@Column(name = "cardSpecialTipsContent")
	private String		cardSpecialTipsContent;

	@Column(name = "cardZone")
	private String		cardZone;

	@Column(name = "cardsalecode")
	private String		cardSaleCode;

	@Column(name = "cardDownLoadCount")
	private Integer		cardDownLoadCount;				// 下载次数

	@Column(name = "cardValidityTime")
	private Long		cardValidityTime;

	@Column
	private String		cardSpecialTips;

	@Column
	@Temporal(TemporalType.TIMESTAMP)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date		cardCreateTime	= new Date();
	
	@Column
	private String		distanceX;

	@Column
	private String		distanceY;

	@Column(name = "is_show")
	private Boolean		show;

	@ManyToOne(optional = true, cascade = { CascadeType.MERGE, CascadeType.REFRESH })
	@JoinColumn(name = "cardclass")
	@NotFound(action = NotFoundAction.IGNORE)
	private CardType	cardTaste;						// 优惠卡类型

	@ManyToOne(optional = true, fetch = FetchType.EAGER)
	@NotFound(action = NotFoundAction.IGNORE)
	@JSONField(serialzeFeatures = SerializerFeature.DisableCircularReferenceDetect)
	@JoinColumn(name = "bsId")
	private Business	business;

	// setter getter
	public String getCardLogo() {
		return cardLogo;
	}

	public void setCardLogo(String cardLogo) {
		this.cardLogo = cardLogo;
	}

	public String getCardName() {
		return cardName;
	}

	public void setCardName(String cardName) {
		this.cardName = cardName;
	}

	public String getCardType() {
		return cardType;
	}

	public void setCardType(String cardType) {
		this.cardType = cardType;
	}

	public String getCardSummary() {
		return cardSummary;
	}

	public void setCardSummary(String cardSummary) {
		this.cardSummary = cardSummary;
	}

	public String getCardSummaryContent() {
		return cardSummaryContent;
	}

	public void setCardSummaryContent(String cardSummaryContent) {
		this.cardSummaryContent = cardSummaryContent;
	}

	public String getCardAddress() {
		return cardAddress;
	}

	public void setCardAddress(String cardAddress) {
		this.cardAddress = cardAddress;
	}

	public String getCardSpecialTipsContent() {
		return cardSpecialTipsContent;
	}

	public void setCardSpecialTipsContent(String cardSpecialTipsContent) {
		this.cardSpecialTipsContent = cardSpecialTipsContent;
	}

	public String getCardZone() {
		return cardZone;
	}

	public void setCardZone(String cardZone) {
		this.cardZone = cardZone;
	}

	public String getCardSaleCode() {
		return cardSaleCode;
	}

	public void setCardSaleCode(String cardSaleCode) {
		this.cardSaleCode = cardSaleCode;
	}

	public Integer getCardDownLoadCount() {
		return cardDownLoadCount;
	}

	public void setCardDownLoadCount(Integer cardDownLoadCount) {
		this.cardDownLoadCount = cardDownLoadCount;
	}

	public String getCardSpecialTips() {
		return cardSpecialTips;
	}

	public void setCardSpecialTips(String cardSpecialTips) {
		this.cardSpecialTips = cardSpecialTips;
	}

	public CardType getCardTaste() {
		return cardTaste;
	}

	public void setCardTaste(CardType cardTaste) {
		this.cardTaste = cardTaste;
	}

	public Boolean getShow() {
		return show;
	}

	public void setShow(Boolean show) {
		this.show = show;
	}

	public Date getCardCreateTime() {
		return cardCreateTime;
	}

	public void setCardCreateTime(Date cardCreateTime) {
		this.cardCreateTime = cardCreateTime;
	}

	public String getDistanceX() {
		return distanceX;
	}

	public void setDistanceX(String distanceX) {
		this.distanceX = distanceX;
	}

	public String getDistanceY() {
		return distanceY;
	}

	public void setDistanceY(String distanceY) {
		this.distanceY = distanceY;
	}

	public Business getBusiness() {
		return business;
	}

	public void setBusiness(Business business) {
		this.business = business;
	}

	public Long getCardValidityTime() {
		return cardValidityTime;
	}

	public void setCardValidityTime(Long cardValidityTime) {
		this.cardValidityTime = cardValidityTime;
	}
}
